#include "StdAfx.h"


void CreateSnake(HDC hdc, RECT *rSnake, int nX, int nY, int nLenght, int nSide)
{
	rSnake[0].left = nX;
	rSnake[0].top = nY;
	rSnake[0].right = nX + nSide;
	rSnake[0].bottom = nY + nSide;
	 
	for (int i = 1; i < nLenght; i++)
	{
		rSnake[i].left = rSnake[i-1].left+nSide;
		rSnake[i].top = rSnake[i-1].top;
		rSnake[i].right = rSnake[i-1].right+nSide;
		rSnake[i].bottom = rSnake[i-1].bottom;
	}
	
}

void PaintSnake(HDC hdc, RECT *rSnake, int nLenght)
{
	while(NULL != rSnake)
	{
		for (int i = 0; i < nLenght; i++)
		{
			Rectangle(hdc, rSnake[i].left, rSnake[i].top, rSnake[i].right, rSnake[i].bottom);
		}
	}
}